<!DOCTYPE html>
<html>
<head>
	<title>WebSocket Chat</title>
	<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
	<script>
        var socket = new WebSocket("ws://localhost:8080/websocket");

        socket.onmessage = function (event) {
            var message = event.data;
            $("#messages").append("<p>" + message + "</p>");
        };

        function sendMessage() {
            var message = $("#message").val();
            socket.send(message);
            $("#message").val("");
        }
	</script>
</head>
<body>
<h1>WebSocket Chat</h1>
<div id="messages"></div>
<input type="text" id="message">
<button onclick="sendMessage()">Send</button>
</body>
</html>
